<?php

/**
 * 电控系统电费预警定时任务发送消息模版
 * @author Administrator
 */
class DormSendMessageMsgtpl extends BaseMsgtpl
{

	/**
	 * 给管理员发消息
	 */
	public function sendMessageToManage($wechat_id, $manager, $address)
	{
		$wechat = D('Wechat')->get($wechat_id);
		session('account_id', $wechat['account_id']);
		
		if($manager) {
			foreach($manager as $key => $v) {
				$fans = D('Fans')->get($v['fans_id'], 'openid,subscribe,wechat_id');
				if($fans['subscribe']) {
					
					if($wechat_id == 17) {
						$this->wxTplSign = '1aGgF7Tmm6g6qEEJH7bauGVBZIsYJwi0DqH1mQinqn8';
					}

					$info = array(
						'first' => array("value" => $address . '路线的公车预约已结束，请前往后台及时处理'),
						'keyword1' => array("value" => '假日包车进度提醒'),
						'keyword2' => array("value" => date('Y-m-d H:i')),
						'keyword3' => array("value" => '预约已结束'),
						'remark' => array("value" => '详情请登录系统查看'),
					);
					$this->wxObj->messageTpl($wechat['appid'], $wechat['appsecret'], $fans['openid'], $this->wxTplSign, $info, '');
				}
			}
		}
	}

}
